Skip to content

fix(openapi): add relation x-* hints to output schemas too - #10

Merged
schmunk42 merged 1 commit into
masterfrom
feature/relation-hints-on-output-schemas
Oct 9, 2026
Merged

schmunk42 merged 1 commit into
masterfrom
feature/relation-hints-on-output-schemas

Conversation

@eluhr

@eluhr eluhr commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Problem

RelationFieldSchemaDecorator only decorated input schemas with x-collection, x-label-property, x-value-property, x-search-property and x-resource-class.

Resources that declare serialization groups get no plain <Name> schema from API Platform, only the grouped <Name>.jsonld-<group>.read and <Name>-<group>.write variants. A client that builds its forms from the read schema (the Vue admin UI does) therefore never saw the hints, and iri-reference fields rendered as bare string inputs instead of the type-ahead from dmstr/jedison-extender-bundle.

Example before (MenuNode.jsonld-menu_node.read):

"menu": { "type": "string", "format": "iri-reference" }

Change

The decorator now processes output schemas as well; the hints are purely additive metadata and harmless on reads. After this change the same read schema carries "x-collection": "/api/admin/menus" and friends.

Verified on a za7 stack with the admin UI: the menu and parent fields on the MenuNode form show the type-ahead with members of /api/admin/menus / /api/admin/menu_nodes.

Notes

  • No test added — the decorator has no test coverage yet; happy to add one if wanted.
  • Not changed in this PR: the decorator applies the root class's relation metadata to every embedded definition, so a same-named property on an embedded resource could receive the wrong hints. That pre-existing behaviour is now also reachable through read schemas (which embed more often than input schemas). Did not observe it on the stack I tested, but worth a follow-up.

🤖 Generated with Claude Code

Clients that build forms from the read schema never saw x-collection and
friends, because resources with serialization groups have no plain schema
and the decorator only handled input schemas. iri-reference fields then
rendered as bare string inputs instead of the type-ahead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@schmunk42 schmunk42 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved — additive metadata, no breaking change.

Follow-ups:

  • #11: the decorator applies the root class's relation hints to foreign definitions; this PR widens it to output schemas, so it should be fixed next (including the test offered here).
  • dmstr/jedison-extender-bundle#2: link to the related record in read-only state — builds on the hints this PR adds to read schemas, and depends on #11.

@schmunk42
schmunk42 merged commit 02a13fb into master Oct 9, 2026
2 checks passed
@schmunk42
schmunk42 deleted the feature/relation-hints-on-output-schemas branch October 9, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants